Hi all,
void outputMetricResult()
{
loggerDebug("(outputMetricResult) Starting.");
Skip skpTempOutput1, skpTempOutput2, skpTempOutput3;
string strCmp, strMetric, strArtifactType;
int i;
// iterate over all components
for skpTempOutput1 in skpComponents do
{
strCmp = (string key(skpComponents));
loggerDebug("Component key: " strCmp "");
// iterate over all metrics
for skpTempOutput2 in skpTempOutput1 do
{
strMetric = (string key(skpTempOutput1));
loggerDebug("Metric key: " strMetric "");
// iterate over all artifact types
for i in skpTempOutput2 do
{
strArtifactType = (string key(skpTempOutput2));
loggerDebug("Artifact Type key: " strArtifactType ": " i "");
}
}
}
loggerDebug("(outputMetricResult) Completed.");
}
string strCurrentComponent; // filled somewhere else beforehands
string strCurrentArtifactType; // filled somewhere else beforehands
Skip skpTempCmp;
Skip SkpTempMtrc;
Skip skpComponents = createString() // Structure is build somewhere else as defined above.
bool addValueToCurrentIntForMetric(string strMetricName, int intIncrementor)
{
if(find(skpComponents, "" strCurrentComponent "", skpTempCmp))
{
if(find(skpTempCmp, "" strMetricName "", skpTempMtrc))
{
/*
if(find(skpTempMtrc, strCurrentArtifactType, intFromSkip))
{
intFromSkip = intFromSkip + intIncrementor;
return true;
}
else
{
print("Couldn't find skip for artifact type: '" strCurrentArtifactType "'.");
return true;
}
*/
}
else
{
print("Couldn't find skip for metric: '" strMetricName "'.");
return true;
}
}
else
{
print("Couldn't find skip for component: '" strCurrentComponent "'.");
return true;
}
}
SystemAdmin - Tue Apr 05 05:36:19 EDT 2011 |
Re: Finding a Skip type element in a Skip SKIP ....SKIP ........SKIP ............INT ............INT ............INT ........SKIP ............INT ............INT ............INT etc. |
Re: Finding a Skip type element in a Skip Note, when you nest skip lists, you must be careful to loop through all lists and individually delete all child lists at the end of your script, just deleting "skpComponents" will give you a memory leak. Regards, Peter |
Re: Finding a Skip type element in a Skip Peter_Albert - Tue Apr 05 06:03:38 EDT 2011 That's one of the things you don't see when you implement the script. I got around the other problems in the meanwhile as well by reimplementing some DOORS functionality with my own code. Works nicely, even if rather slow ;) Thanks for your support. Best Regards, Alexander |
Re: Finding a Skip type element in a Skip SystemAdmin - Tue Apr 05 07:55:57 EDT 2011 Auto-declare In DXL there is a mechanism called auto-declare, which means that a user need not specify a type for a variable. For example, in the script: i=5 print i the interpreter declares a new variable and deduces from the assignment that its type is int. Because DXL is case-sensitive, there is a potential hazard when relying on this mechanism to type variables. If you make a mistake when typing a variable name, the interpreter assumes that a new variable is being used, which creates errors that are hard to find. This feature can be disabled by adding the line: XFLAGS_ &=~AutoDeclare_ to the bottom of the file $DOORSHOME/lib/dxl/startup.dxl. |
Re: Finding a Skip type element in a Skip SystemAdmin - Tue Apr 05 07:55:57 EDT 2011 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: Finding a Skip type element in a Skip Nit-Picks: These may matter: I don't see any reason to search for , when strCurrentComponent will do. Its more confusing and wastes space. And if the 1st paragraph is true then this is triggering the error. In your 2nd example, variables Skip skpTempCmp; Skip SkpTempMtrc; should be declared locally to function addValueToCurrentIntForMetric(). That info is not shared with anybody else, and declaring globally may mean that some other function may indeed rely on them after the call, which would cause a problem like an exception violation.
|
Re: Finding a Skip type element in a Skip SystemAdmin - Tue Apr 05 08:07:05 EDT 2011 There are other reasons having to do with overloaded functions: oTarget = target(lnk). Turns out oTarget was an "Object" in DOORS v7 and a "ModName_" in v8 triggering excessive Layout errors in my partner's sloppy code ... in every view of every module in his sloppy project ... pushing back our upgrade by two weeks and causing certain <Disallowed Content Detected> customers to show their true colors. And causing all those errors on certain Perfectly Reasonable DXL Coders client PCs, who rightfully turn off autodeclare. But it was worth it, not having to spend one full second typing "Object ". And its confusing. The AutoDeclare feature provides nothing useful; except in writing code nobody else can understand preserving the author's job.
|